<script setup lang="ts">
import dayjs from 'dayjs';

interface Props {
  /**
   * 设备变更操作记录
   */
  list: AppSysAssetChange.OperateDto[];
}

const props = withDefaults(defineProps<Props>(), {
  list: () => [],
});
</script>

<template>
  <view class="asset-change-operate-list">
    <view class="asset-change-operate-item" v-for="(item, index) in props.list" :key="item.id">
      <view class="asset-change-operate-item--left">
        <text class="asset-change-operate-item__time">
          {{ item.operateTime ? dayjs(Number(item.operateTime)).format('MM/DD HH:mm') : '-' }}
        </text>
      </view>
      <view class="asset-change-operate-item--center">
        <view class="asset-change-operate-item__dot"></view>
        <view v-if="index + 1 !== props.list.length" class="asset-change-operate-item__line"></view>
      </view>
      <view class="asset-change-operate-item--right">
        <view class="asset-change-operate-item__name">{{ item.operateTypeName }}</view>
        <view v-if="item.userName">
          <text>操作人:&nbsp;&nbsp;</text>
          <text>{{ item.userName }}</text>
        </view>
        <!-- <view v-if="item.approvalResult">
          <text>审批结果:&nbsp;&nbsp;</text>
          <text>{{ item.approvalResult }}</text>
        </view> -->
        <view v-if="item.approvalView">
          <text>操作说明:&nbsp;&nbsp;</text>
          <text>{{ item.approvalView }}</text>
        </view>
      </view>
    </view>
  </view>
</template>

<style lang="scss">
@import './index.scss';
</style>
